package com.ruoyi.common.config;

import com.ruoyi.common.utils.file.MinioUtil;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import io.minio.MinioClient;
import org.springframework.beans.factory.annotation.Value;

/**
 * Minio 配置信息
 *
 * @author ruoyi
 */
@Configuration
@Data
@ConfigurationProperties(prefix = "minio")
public class MinioConfig {
  @Value("${minio.endpoint}")
  private String endpoint;
  @Value("${minio.fileHost}")
  private String fileHost;
  @Value("${minio.bucketName}")
  private String bucketName;
  @Value("${minio.accessKey}")
  private String accessKey;
  @Value("${minio.secretKey}")
  private String secretKey;

  @Value("${minio.imgSize}")
  private Integer imgSize;
  @Value("${minio.fileSize}")
  private Integer fileSize;

  @Bean
  public MinioUtil creatMinioClient() {
    return new MinioUtil(endpoint, bucketName, accessKey, secretKey, imgSize, fileSize);
  }
}
